package cn.jia.spring1.entity;

/**
 * Created by jia on 2018/3/26.
 */
public class Knight {
    private String name;
    public Knight(String name){
        this.name=name;
    }
    //如果写了有参构造方法，如果要new无参构造方法的话会报错
    public Knight(){
        //如果在bean中配置了，启动项目时会执行
        System.out.println("无参构造方法执行！");
    }
    @Override
    public String toString() {
        return "Knight{" +
                "name='" + name + '\'' +
                '}';
    }

    public static void main(String[] args) {
        new Knight();
    }
}
